import commonData from "./data";


const CommonReducer = (state = commonData, action) => {
    switch (action.type) {
        case "SET_USERINFO":
            return Object.assign({}, state, {
                userInfo: action.data
            });
        case "SET_ENV":
            return Object.assign({}, state, {
                env: action.data
            })
        case "SET_MAINSERVER":
            return Object.assign({}, state, {
                mainServer: action.data
            })
        case "SET_RESOURCEADDR":
            return Object.assign({}, state, {
                ResourceServerAddr: action.data
            })
        case "SET_PUBLICINFOADDR":
            return Object.assign({}, state, {
                PublicInfoServerAddr: action.data
            })
        case "SET_BASEURL":
            return Object.assign({}, state, {
                baseUrl: action.data
            })
        case "SET_IDENTITYCODE":
            return Object.assign({}, state, {
                lg_ic: action.data
            })
        case "SET_TOKEN":
            return Object.assign({}, state, {
                token: action.data
            })
        case "SET_MODULEINFO":
            return Object.assign({}, state, {
                moduleInfo: action.data
            });
        case "SET_NOTICEADDR":
            return Object.assign({}, state, {
                noticeAddr: action.data
            })
        case "SET_SYSTEMINFO":
            return Object.assign({}, state, {
                systemInfo: action.data
            })
        case "SET_ADVANCEDADMIN":
            return Object.assign({}, state, {
                advancedAdmin: action.data
            })
        case "SET_ISMANAGE":
            return Object.assign({}, state, {
                isManage: action.data
            })
        default:
            return state;
    }
}

/**
 * 如果有多个reducer函数，则可以使用combineReducers进行合并
 *export default combineReducers({
     reducer1,
     reducer2
 })
 */
export default CommonReducer;